//Import Data
use "~/becker.dta"

//Create PMC-Use Lag
sort countrycode year
by countrycode: gen lag_pmcUse = pmcUse[_n-1]

//Create Cubic Polynomial for Year
btscs pmcOnset year countrycode, g(country_years)
sort countrycode year
gen country_years2 = country_years^2
gen country_years3 = country_years^3


//Explaining PMC use:
//Model 1 (fails due to lack of overlap between pmcUse and LagCoupPlotDiscovered)
relogit pmcUse Diamonds Oil LagCoup LagCoupAttempt LagCoupPlotDiscovered Civil_War, cluster(countrycode)
//Model 2 (baseline: all coefficients positive, 4/5 significant)
relogit pmcUse Diamonds Oil LagCoup LagCoupAttempt Civil_War, cluster(countrycode)
//Model 3 (add lag_pmcUse: all coefs positive, 4/6 significant)
relogit pmcUse Diamonds Oil LagCoup LagCoupAttempt Civil_War lag_pmcUse, cluster(countrycode)

//Robustness checks:
//Model 4 (use pmcOnset as DV: all coefs positive, Oil and Civil_War significant)
relogit pmcOnset Diamonds Oil LagCoup LagCoupAttempt Civil_War, cluster(countrycode)
//Model 5 (cubic polynomials for time dependence: all coefs positive Oil and Civil_War significant)
relogit pmcUse Diamonds Oil LagCoup LagCoupAttempt Civil_War lag_pmcUse country_years*, cluster(countrycode)
//Model 6 (replicate Model 2, dropping years > 1997)
relogit pmcUse Diamonds Oil LagCoup LagCoupAttempt Civil_War lag_pmcUse if year < 1998, cluster(countrycode)

//Testing Reno's implied hypothesis
clear
use "~/beckerPlusFDI.dta"
sort countrycode year
by countrycode: gen lag_pmcUse = pmcUse[_n-1]
relogit pmcUse Diamonds Oil LagCoup LagCoupAttempt Civil_War FDIbyGDP lag_pmcUse, cluster(countrycode)

//Explaining PMC service choice
//Diff-in-proportions test confirms that most privatization is at base of spear
prtest spearTip == .5
//Logit shows that resources drive privatization at tip of spear
logit spearTip Diamonds Oil LagCoup LagCoupAttempt Civil_War, cluster(countrycode)
